package cn.laixueit.service.impl;

import cn.laixueit.mapper.PhotoMapper;
import cn.laixueit.pojo.Photo;
import cn.laixueit.service.PhotoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class PhotoServiceImpl implements PhotoService {

    @Autowired
    PhotoMapper photoMapper;

    @Override
    public void add(Photo photo) {

        photoMapper.insertSelective(photo);
    }

    @Override
    public List<String> list() {
        List<Photo> photoList = photoMapper.selectByExample(null);
        ArrayList<String> strings = new ArrayList<>();
        for (Photo photo : photoList) {
            strings.add(photo.getImgurl());
        }
        return strings;
    }
}
